package com.k.kppcloud.provider;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试 内部调用 provider 服务及负载均衡
 */
@EnableDiscoveryClient
@Controller
@SpringBootApplication
public class InnerProviderApp {
    public static void main( String[] args ) {
        SpringApplication.run(InnerProviderApp.class);
    }

    @Value("${spring.application.name}")
    private String serverName;
    @Value("${server.port}")
    private String serverPort;
    @RequestMapping("/")
    @ResponseBody
    public Map<String,String> index(){
        Map<String,String> map = new HashMap();
        map.put("service",serverName);
        map.put("port",serverPort);
        return map;
    }
}
